Skip to main content
Feedback

Google Analytics 4 walkthrough

Google Analytics 4 (GA4) on Data Integration provides seamless integration of GA4 data into data warehouses. This integration automates data extraction, enabling efficient analysis.

Prerequisites

Connection setup

To connect Google Analytics 4 (GA4) with your destination, follow the step-by-step tutorial.

  • Source connection: Select your existing Google Analytics connection or create a new one.
  • River mode: Choose between Predefined Reports or Custom Report.
  • API version: Select Google Analytics 4.

Configure property scope

You can define the scope of data retrieval using the GA4 Accounts and GA4 Properties fields.

note

Leaving the GA4 Properties field empty triggers the connector to fetch all available GA4 properties associated with the account.

GA4 API quota and limits

Google Analytics Data API enforces token-based quotas per property. Each API request consumes tokens based on the query's complexity. For more information, refer to Data API limits and quotas topic.

The following quotas apply per GA4 property:

Quota TypeStandard GA4Analytics 360
Daily Tokens200,0002,000,000
Hourly Tokens40,000400,000
Concurrent Requests1050

Each API request consumes 10–50 tokens, depending on:

  • Number of metrics requested.
  • Number of dimensions included.
  • Query complexity.
  • Pagination for large datasets.

Factors affecting execution time

The execution time of a river depends on several factors:

  • A 20-second pause between API calls to avoid rate limits.
  • Number of GA4 properties selected.
  • Date range of the query (longer ranges mean more API calls per property).
  • Number of metrics and dimensions.
  • Pagination required for large datasets. Large datasets may require multiple calls per property.

When many properties or long date ranges are selected, the river may take longer to complete.

Property limits and execution

For optimal performance, consider the following guidelines:

Number of PropertiesEstimated Execution TimeRecommendation
1–50~17 minutesRecommended
51–100~35 minutesAcceptable
101–500~2–3 hoursConsider splitting
500+3+ hoursSplit into multiple runs
note

Google's API has a limit of 40,000 tokens per property per hour for Standard GA4 accounts.

Best practices

  • Limit runs to up to 100 GA4 properties per river when possible.
  • If your account contains many properties, divide them across multiple rivers.
  • Use shorter date ranges to reduce the number of API calls.
  • Avoid highly complex queries with many metrics and dimensions when working with large property sets.

Select predefined reports

Data Integration provides a convenient entry point and recommended approach for accessing a range of predefined reports. Each report includes a concise data description, a list of customizable fields (if applicable), and the schema mapping.

These reports follow a standardized format so you can access specific fields only through Custom Reports.

Select custom reports

Google Analytics 4 (GA4) provides advanced tracking and analysis capabilities to help businesses gain valuable insights into user behavior and website performance.

In GA4, there are two main report types:

  • Cohort Report
  • Standard Report

To learn more about the Google Analytics Data API, refer to the Google documentation.

GA4 cohort report

The Cohort Report helps you analyze user behavior within specific user groups during a designated time frame. A cohort is a group of users who share a characteristic or experience within a defined period. The Cohort Report provides valuable insights into the long-term behavior of these user groups, letting you monitor user acquisition daily, weekly, or monthly.

GA4 standard report

The Standard Report in GA4 provides pre-configured insights into various aspects of your website or app performance. This report covers audience, acquisition, behavior, and conversions, letting you understand user behavior, traffic sources, popular content, and conversion rates.

Select time period

This report lets you extract the data by selecting a time period.

note
  • Start Date is mandatory.
  • You can retrieve data for the date range between the Start and End dates.
  • If you leave the End Date blank, the data is pulled at the current time of the River's run.
  • Dates timezone: UTC time.
  • The Start Date does not advance if a River run is unsuccessful. If you do not want this default setting, click More Options and turn on the Update incremental date range also on failures checkbox to advance the start date even if the River run is unsuccessful (not recommended).
  • Use the Last Days Back For Each Run option to gather data from a specified number of days before the selected start date.

Time chunk size

This feature lets you partition your data into intervals, which is beneficial when working with large data volumes. The data is divided based on the specified size of the interval, letting you make manageable data calls.

Select dimension and metrics

GA4 provides businesses with insights into user behavior and website performance. Dimensions represent user attributes, while metrics offer quantitative measurements. Together, they help analyze data, gain audience insights, and optimize marketing strategies. By segmenting data and tracking performance, businesses can make informed decisions to achieve their goals.

Dimensions

Dimensions in GA4 represent characteristics or scopes of events, users, or items. They provide descriptive information that helps segment and categorize data. GA4 includes predefined dimensions such as user ID, device type, country, and traffic source, which offer valuable insights into user behavior and demographics.

Select Metrics

Metrics in GA4 represent measurable data points that quantify user interactions, conversions, and key performance indicators. GA4 provides a wide range of predefined metrics such as pageviews, sessions, bounce rate, and average session duration, giving a comprehensive view of website or app performance.

note

Advanced options

The Custom Dimensions and Metrics feature is available in the Advanced Options section. Custom dimensions and metrics are elements you create to examine data tailored to your business needs. You can use them when establishing custom event parameters or user properties.

Creating custom dimensions

Prerequisite

To create custom dimensions and metrics, you must have Editor or Administrator role.

  1. Click the Admin within Google Analytics.

  2. Access the Custom Definitions section within the Property column.

  3. In the Custom dimensions tab, click Create custom dimensions.

  4. Provide the following details:

    a. Name of the dimension: Enter a distinct name for the dimension. Hyphens are not permitted; use underscores and spaces instead.
    b. Scope: Select a scope for the dimension.
    c. Description: Provide a description for the dimension.
    d. Event parameter/User property: Choose the data source.

  5. Click Save.

note

During the initial 48 hours, your custom dimension will have a value of (not set) assigned to it.

Creating custom metrics

  1. Click the Admin within Google Analytics.

  2. Access the Custom Definitions section within the Property column.

  3. In the Custom metrics tab, click Create custom metrics.

  4. Provide the following details:

    a. Name of the metric: Enter a distinct name for the metric. Hyphens are not permitted; use underscores and spaces instead.
    b. Scope: Ensure you create a metric scoped to an event.
    c. Description: Enter a memorable description for the custom metric.
    d. Event parameter: Select the data source for the metric.
    e. Unit of measurement: Choose the appropriate unit of measurement.

  5. Click Save.

note

During the initial 48 hours, your custom dimension will have a value of (not set) assigned to it.

For additional details about Scopes, Units of measurement, and the Source of data, refer to the Google Analytics documentation.

Sub Rivers in GA4

Google Analytics 4 introduces a set of Sub Rivers fields. These fields let you delve deeper into the analytics data and gain specific insights from your website or app performance:

  • Account IDs
  • Source Connection
  • Account Properties
  • Time Period
  • Target Connection
  • Database Name
  • Schema

Optimizing loading errors through expression casting

If you use Snowflake or BigQuery as your target, you might encounter the following error if the expressions are not correct:

Loading failed: Merge into DB.SCHEMA.GA_sessions failed. Error - ('22007', "[22007] Can't parse '0' as date with format 'YYYYMMDD' (100097) (SQLExecDirectW)")

To prevent this error, apply the recommended expression as indicated below:

image.png

When using Snowflake as the Target, use the following expression:

CASE WHEN date = 0 THEN '1900-01-01'::DATE ELSE TO_DATE(CAST(date AS VARCHAR), 'YYYYMMDD')::DATE END

When using BigQuery as your Target, use the following expression:

SAFE.PARSE_DATETIME("%Y%m%d", CAST(date AS STRING))

Google Analytics 4 API filtering limitations

Google Analytics prioritizes user privacy. If your query involves restricted data (such as demographics), recent time frames, or intricate filters, you might view a decrease in results.

In the event of a noticeable decline, consider extending your time frame, streamlining filters, or promoting the opt-in for Google Signals to access more comprehensive data.

Prevent data loss in Google Analytics and its API:

  1. Reduce number of filters:

    • Minimize the number of filters for essential analysis.
    • Avoid non-crucial filters.
  2. Merge filters: Combine multiple filters for efficiency.

  3. Widen filter criteria: To capture a broader data range, make filter conditions less specific. For instance, filter for a category rather than a specific page.

  4. Remove unnecessary dimensions: Remove dimensions that are not directly relevant to your analysis.

  5. Explore alternative dimensions: Consider using alternative dimensions for similar insights with less complexity. For example, filter by region instead of city.

  6. Consistency in dimension and metric usage: Ensure that you employ identical Dimensions and Metrics in both Data Integration and Google Analytics.

  7. Adjust time frames: Expand the query time frame to access more data, particularly with less common dimensions or filters.

On this Page